package edu.chl.dat076.datesite.entities;

import java.io.Serializable;
import javax.persistence.Embeddable;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ManyToOne;


/**
 *
 * @author Christoffer
 * @author Mikey
 */
@Embeddable
//@Access(AccessType.PROPERTY)
public class PartnerCriteria implements Serializable {
	private static final long serialVersionUID = 1L;

	int pcMinAge;
	int pcMaxAge;
	int pcMinHeight;
	int pcMaxHeight;
	private boolean pcTobaccoUser;
	private boolean pcChildren;
	@Enumerated(EnumType.STRING)
	Gender pcGender;
	
	@ManyToOne
	Town pcTown;
	@ManyToOne
	County pcCounty;

	public PartnerCriteria() {
	}
        
        /**
         * A special constructor for Search
         */
        public PartnerCriteria(int minAge, int maxAge, int minHeight, int maxHeight, boolean tobaccoUser, boolean children) {
		this.pcMinAge = minAge;
		this.pcMaxAge = maxAge;
		this.pcMinHeight = minHeight;
		this.pcMaxHeight = maxHeight;
		this.pcTobaccoUser = tobaccoUser;
		this.pcChildren = children;
        }

	public PartnerCriteria(int minAge, int maxAge, int minHeight, int maxHeight, boolean tobaccoUser, boolean children, Gender gender, Town town, County county) {
		this.pcMinAge = minAge;
		this.pcMaxAge = maxAge;
		this.pcMinHeight = minHeight;
		this.pcMaxHeight = maxHeight;
		this.pcTobaccoUser = tobaccoUser;
		this.pcChildren = children;
		this.pcGender = gender;
		this.pcTown = town;
		this.pcCounty = county;
	}

	public boolean isPcChildren() {
		return pcChildren;
	}

	public County getPcCounty() {
		return pcCounty;
	}

	public Gender getPcGender() {
		return pcGender;
	}

	public int getPcMaxAge() {
		return pcMaxAge;
	}

	public int getPcMaxHeight() {
		return pcMaxHeight;
	}

	public int getPcMinAge() {
		return pcMinAge;
	}

	public int getPcMinHeight() {
		return pcMinHeight;
	}

	public boolean isPcTobaccoUser() {
		return pcTobaccoUser;
	}

	public Town getPcTown() {
		return pcTown;
	}

	public void setPcChildren(boolean pcChildren) {
		this.pcChildren = pcChildren;
	}

	public void setPcCounty(County pcCounty) {
		this.pcCounty = pcCounty;
	}

	public void setPcGender(Gender pcGender) {
		this.pcGender = pcGender;
	}

	public void setPcMaxAge(int pcMaxAge) {
		this.pcMaxAge = pcMaxAge;
	}

	public void setPcMaxHeight(int pcMaxHeight) {
		this.pcMaxHeight = pcMaxHeight;
	}

	public void setPcMinAge(int pcMinAge) {
		this.pcMinAge = pcMinAge;
	}

	public void setPcMinHeight(int pcMinHeight) {
		this.pcMinHeight = pcMinHeight;
	}

	public void setPcTobaccoUser(boolean pcTobaccoUser) {
		this.pcTobaccoUser = pcTobaccoUser;
	}

	public void setPcTown(Town pcTown) {
		this.pcTown = pcTown;
	}
        
	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		final PartnerCriteria other = (PartnerCriteria) obj;
		if (this.pcMinAge != other.pcMinAge) {
			return false;
		}
		if (this.pcMaxAge != other.pcMaxAge) {
			return false;
		}
		if (this.pcMinHeight != other.pcMinHeight) {
			return false;
		}
		if (this.pcMaxHeight != other.pcMaxHeight) {
			return false;
		}
		if (this.pcTobaccoUser != other.pcTobaccoUser) {
			return false;
		}
		if (this.pcChildren != other.pcChildren) {
			return false;
		}
		if (this.pcGender != other.pcGender) {
			return false;
		}
		if (this.pcTown != other.pcTown && (this.pcTown == null || !this.pcTown.equals(other.pcTown))) {
			return false;
		}
		if (this.pcCounty != other.pcCounty && (this.pcCounty == null || !this.pcCounty.equals(other.pcCounty))) {
			return false;
		}
		return true;
	}

	@Override
	public int hashCode() {
		int hash = 7;
		return hash;
	}
}